package edu.towson.cis.cosc442.project2.vendingmachine;

import static org.junit.Assert.assertEquals;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;


public class VendingMachineItemTest {
	VendingMachineItem item1, item2, item3;
	
	//Setup method
	@Before
	public void setUp(){
		item1 = new VendingMachineItem("Godiva Chocolate", 3.99);
		item2 = new VendingMachineItem("Skittles", 1.00);
	}
	//This method tests the constructors
	@Test
	public void testConstructors() {
		VendingMachineItem m1 = new VendingMachineItem("Godiva Chocolate", 3.99);
		VendingMachineItem m2 = new VendingMachineItem("Godiva Chocolate", 3.99);
		item3 = new VendingMachineItem("Skittles2", 0.00);

	    assertEquals(m1.getName(), m2.getName());
	}
	//Tests the getName Method
	@Test
	public void testGetName() {
		assertEquals("Godiva Chocolate", item1.getName());
		assertEquals("Skittles", item2.getName());
	}
	
	//Tests getPrice Method
	@Test
	public void testGetPrice() {
		assertEquals(3.99, item1.getPrice(),0.001);
		assertEquals(1.00, item2.getPrice(),0.001);
	}

	//Tear Down Method
	@After
	public void tearDown(){
		item1 = null;
		item2 = null;
		item3 = null;
	}
}
